<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://agi.corp.org/authz" prefix="authz"%>
<%@ page import="th.co.mfec.mca.common.PrivConst"%>

<script type="text/javascript" src="${requestScope.jsBase}/jQuery.dualListBox-1.0.1.min.js"></script>

<script language="javascript" type="text/javascript">
        $j(function() {
            $j.configureBoxes();
        });
    </script>

<!-- body content -->
<!-- / body content -->
<div id="content">
<s:form id="mainForm" action="userProfileManagement-add.htm" method="post" >
 <s:hidden id="uspId" name="userProfileBean.uspId" />
 <div class="tableContent">
 	<div id="dialoginfo"></div>
    <div class="topic">View User Profile</div>
    
    <div class="tableContent">
            <table>
            <colgroup class="L"></colgroup><colgroup class="R"></colgroup><colgroup class="L"></colgroup><colgroup class="R"></colgroup>
              <tr>
                <th nowrap="nowrap">Username : </th>
                <td>
                	<s:textfield id="uspUserName" name="userProfileBean.uspUserName" maxlength="50" readonly="true" />
                	<br/><span id="errorsDiv_userProfileBean.uspUserName"></span>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">Title : </th>
                <td>
                	<s:textfield id="uspTitle" name="userProfileBean.uspTitle" readonly="true" maxlength="50" />
                	<br/><span id="errorsDiv_userProfileBean.uspTitle"></span>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">First name : </th>
                <td>
                	<s:textfield id="uspFname" name="userProfileBean.uspFname" maxlength="50" readonly="true" />
                	<br/><span id="errorsDiv_userProfileBean.uspFname"></span>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">Middle name :</th>
                <td><s:textfield name="userProfileBean.uspMname" maxlength="50" readonly="true" /></td>
              </tr>
              <tr>
                <th nowrap="nowrap">Last name :</th>
                <td>
                	<s:textfield id="uspLname" name="userProfileBean.uspLname" maxlength="50" readonly="true" />
                	<br/><span id="errorsDiv_userProfileBean.uspLname"></span>
                </td>
              </tr>
              <!-- Start Added -->
              <tr>
                <th nowrap="nowrap">Tel no :</th>
                <td>
                	<s:textfield id="uspTelNo" name="userProfileBean.uspTelNo" maxlength="50" readonly="true" />
                	<br/><span id="errorsDiv_userProfileBean.uspTelNo"></span>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">Mobile no :</th>
                <td>
                	<s:textfield id="uspMobileNo" name="userProfileBean.uspMobileNo" maxlength="50" readonly="true" />
                	<br/><span id="errorsDiv_userProfileBean.uspMobileNo"></span>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">E-mail :</th>
                <td>
                	<s:textfield id="uspEmail" name="userProfileBean.uspEmail" maxlength="50" readonly="true" />
                	<br/><span id="errorsDiv_userProfileBean.uspEmail"></span>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">Expire Date :</th>
                <td>
                	<s:label id="uspExpireDate" name="userProfileBean.uspExpireDateFormatted"/>
                	<br/><span id="errorsDiv_userProfileBean.uspExpireDate"></span>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">Last Access Date :</th>
                <td>
                	<s:label id="uspLastAccessDate" name="userProfileBean.uspLastAccessDateFormatted"/>
                	<br/><span id="errorsDiv_userProfileBean.uspLastAccessDate"></span>
                </td>
              </tr>
              <!-- End Added -->
              <tr>
                <th nowrap="nowrap">Status :</th>
                <td><s:radio name="userProfileBean.uspStatus" list="statusList" listKey="value" listValue="label" disabled="true" /></td>
              </tr>
              <tr><td colspan="2">&nbsp;</td></tr>
			  <!-- Start Added For Admin -->
			  <authz:authorize granted="<%=PrivConst.S010201%>" >
			  <tr>
			  	<td><center>For Admin</center></td>
			  	<td></td>
			  </tr>
			  <tr>
                <th nowrap="nowrap">Wrong login counter :</th>
                <td>
                	<s:label id="uspWrongLoginCounter" name="userProfileBean.uspWrongLoginCounter"/> times
                </td>
              </tr>
			  <tr>
                <th nowrap="nowrap">User lock? :</th>
                <td>
                	<s:label id="uspLockFlag" name="userProfileBean.uspLockFlag"/>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">Force change password :</th>
                <td>
                	<s:label id="uspForceChngPwdFlag" name="userProfileBean.uspForceChngPwdFlag"/>
                </td>
              </tr>
              <tr>
                <th nowrap="nowrap">Password expired :</th>
                <td>
                	<s:label id="passwordExpired" name="userProfileBean.passwordExpired"/>
                </td>
              </tr>
              </authz:authorize>
			  <!-- End Added For Admin -->
			  <tr><td colspan="2">&nbsp;</td></tr>
              <tr>
                <td colspan="4" align="center" style="text-align: center">
                
                <table border="0" align="center" style="width: 630px">
                	<col /><col /><col />
                	<tr>
                		<td valign="top" align="left">
                		<span>Role</span><br />
                        <select id="box1View" multiple="multiple" style="height:300px;width:300px;" disabled="disabled">
                        
                        <s:iterator value="roleList" status="rowstatus" id="roleList">
                        	<option value="<s:property value="value"/>"><s:property value="label"/></option>
                        </s:iterator>
                        
                        </select><br/>
                        <select id="box1Storage">
                    </select>
                		</td>
                
                <td align="left">
                	<table border="0">
                		<tr>
                			<td>&nbsp;</td>
                		</tr>
                		<tr>
                			<td>&nbsp;</td>
                		</tr>
                		<tr>
                			<td>&nbsp;</td>
                		</tr>
                		<tr>
                			<td><div align="center"><button id="to2" type="button" disabled="disabled">&nbsp;>&nbsp;</button></div></td>
                		</tr>
                		<tr>
                			<td><div align="center"><button id="allTo2" type="button" disabled="disabled">&nbsp;>>&nbsp;</button></div></td>
                		</tr>
                		<tr>
                			<td><div align="center"><button id="allTo1" type="button" disabled="disabled">&nbsp;<<&nbsp;</button></div></td>
                		</tr>
                		<tr>
                			<td><div align="center"><button id="to1" type="button" disabled="disabled">&nbsp;<&nbsp;</button></div></td>
                		</tr>
                	</table>     
                </td>
                
                <td align="left">
                		<span>Assigned</span><br />
					<select id="box2View" name="assignedList" multiple="multiple" style="height:300px;width:300px;" disabled="disabled">
                    
                    	<s:iterator value="assignedRolesList" status="rowstatus" id="role">
                        	<option value="<s:property value="value"/>"><s:property value="label"/></option>
                        </s:iterator>
                    
                    </select><br/><span id="errorsDiv_assignedList"></span>
                    <select id="box2Storage">
                    </select>
				</td>
                
                	</tr>
                </table>
				</td>
              </tr>
              
            </table>
   </div> 
 </div>
 <div class="button">
   		<table align="center">
            <tr>
              <td><span id="button"><a href="javascript:onClickBack();"><span><s:text name="button.back" /></span></a></span></td>
              <td><authz:authorize granted="<%=PrivConst.S010300%>" ><span id="button"><a href="javascript:onClickViewLog();" ><span><s:text name="button.viewLog" /></span></a></span></authz:authorize></td>
            </tr>
        </table>
   </div>
</s:form>
</div>

<script>

function onClickBack(){
    $j("#mainForm").attr("action","userProfileManagement-search.htm"); 
  	$j("#mainForm").submit();
}

function onClickViewLog(){
	popupAccessLogUserProfile($j("#uspId").val(),$j("#uspUserName").val());
	//$j("#mainForm").attr("action","userProfileManagement-viewAccessLog.htm"); 
  	//$j("#mainForm").submit();
}

</script>
    